AC_INIT(charon, 0.6)
AM_INIT_AUTOMAKE
AC_PROG_CC
AC_DISABLE_STATIC
AC_PROG_LIBTOOL
AX_CFLAGS_GCC_OPTION(-Wno-pointer-sign)
PKG_CHECK_MODULES(glib, glib)
PKG_CHECK_MODULES(libxml2, libxml-2.0)
PKG_CHECK_MODULES(xmlsec1, xmlsec1)
PKG_CHECK_MODULES(xmlsec1_openssl, xmlsec1-openssl)
AC_MSG_CHECKING(for browser crypto extensions in xmlsec)
ac_link="$ac_link $pkg_cv_xmlsec1_openssl_CFLAGS"
LIBS=$pkg_cv_xmlsec1_openssl_LIBS
AC_TRY_LINK([#include <xmlsec/openssl/crypto.h>], [xmlSecOpenSSLTransformPkcsRsaSha1GetKlass();], AC_MSG_RESULT(yes), AC_MSG_ERROR(no - please see http://wiki.rcpt.to/perl/wiki.pl?XmlsecSupport))
PKG_CHECK_MODULES(ghttp, ghttp)
PKG_CHECK_MODULES(openssl, openssl)
AC_CHECK_HEADER(ecgi.h, [], AC_ERROR(ecgi is required))
AC_CHECK_PROG(pipt, "iptables", $as_dir/$ac_word$ac_exec_ext, no, "/sbin:/usr/sbin:$PATH")
if test x"$pipt" = x"no"; then
	AC_ERROR(iptables required)
else
	AC_DEFINE_UNQUOTED(PATH_IPTABLES, "$pipt", [path to iptables program])
fi
AC_ARG_ENABLE(openwrt, AC_HELP_STRING([--enable-openwrt], [install various administrative files for OpenWRT]), [want_openwrt=yes], [want_openwrt=no])
AM_CONDITIONAL([COND_OPENWRT], [test "$want_openwrt" = yes])
AC_ARG_ENABLE(web-login, AC_HELP_STRING([--enable-web-login], [install web content for user login screens]), [want_weblogin=yes], [want_weblogin=no])
AM_CONDITIONAL([COND_WEBLOGIN], [test "$want_weblogin" = yes])
AC_ARG_ENABLE(web-admin, AC_HELP_STRING([--enable-web-admin], [install admin pages for webif]), [want_webadmin=yes], [want_webadmin=no])
AM_CONDITIONAL([COND_WEBADMIN], [test "$want_webadmin" = yes])
AM_CONFIG_HEADER(config.h)
AC_OUTPUT(Makefile ipkg/Makefile init.d/Makefile init.d/charon openwrt/Makefile web-login/Makefile web-admin/Makefile prepaid/Makefile mcx/Makefile tools/Makefile prepaid/ui/Makefile lib/Makefile)
